<template>
  <div class="header">
    <div class="header-left">
      <div class="iconfont back-icon">&#xe624;</div>
    </div>
    <div class="header-input">
      <span class="iconfont">&#xe632;</span>
      输入城市/景点/市区
    </div>
    <router-link to="/city">
      <div class="header-right">
        {{this.city}}
        <span class="iconfont arrow-right">&#xe64a;</span>
      </div>
    </router-link>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  name: 'HomeHeader',
  computed: {
    // 这是拓展运算符，后期维护时也可以这样导入store/index.js里面的state
    ...mapState(['city'])
  }
}
// scoped, 让这一页的style样式只在这个组件中起作用，不会影响到其他组件
</script>

<style lang="stylus" scoped>
@import '~styles/varibles.styl'
.header
  line-height: $headerHeight
  color: #ffffff
  background-color: $bgColor
  display: flex
  .header-left
    width: .64rem
    float: left
    .back-icon
      text-align: center
      font-size: .40rem
  .header-input
    flex: 1
    height: .62rem
    line-height: .62rem
    background-color: #ffffff
    color: #cccccc
    border-radius: .1rem
    padding-left: .16rem
    margin-left: .2rem
    margin-top: .12rem
  .header-right
    min-width: 1.04rem
    padding: 0 .1rem
    float: right
    text-align: center
    color: #ffffff
    .arrow-right
      margin-left: -.02rem
      font-size: .24rem
</style>
